From 3dd129de692d48ba4565f5848833debcc33ca3aa Mon Sep 17 00:00:00 2001 From: "kaf24@firebug.cl.cam.ac.uk" Date: Tue, 5 Apr 2005 16:55:50 +0000 Subject: [PATCH] bitkeeper revision 1.1274.1.1 (4252c316ZtQV7eOqUOayWDXp7qfbJw) Clean up shadow code presence in common source files. Signed-off-by: Keir Fraser --- .rootkeys | 2 +- xen/common/dom0_ops.c | 1 - xen/common/dom_mem_ops.c | 23 ++---------------- xen/common/domain.c | 1 - xen/common/grant_table.c | 4 +-- xen/common/page_alloc.c | 19 ++------------- xen/include/asm-ia64/shadow.h | 3 --- xen/include/asm-x86/shadow.h | 46 +++++++++++++++++++++++++++++++++++ xen/include/xen/perfc.h | 2 ++ xen/include/xen/shadow.h | 18 ++++++++++++++ 10 files changed, 73 insertions(+), 46 deletions(-) delete mode 100644 xen/include/asm-ia64/shadow.h create mode 100644 xen/include/xen/shadow.h diff --git a/.rootkeys b/.rootkeys index cc381c8f5e..3334f34268 100644 --- a/.rootkeys +++ b/.rootkeys @@ -1288,7 +1288,6 @@ 421098b7Z6OwjZnrTZkh34DoDfcjrA xen/include/asm-ia64/regionreg.h 421098b707cY5YluUcWK5Pc-71ETVw xen/include/asm-ia64/regs.h 4214e2f3fbO_n9Z1kIcBR83d7W4OJw xen/include/asm-ia64/serial.h -421098b7czhvyPGFa5nskL0N4vNvFw xen/include/asm-ia64/shadow.h 421098b7GkWOnlzSmPvNAhByOSZ1Dw xen/include/asm-ia64/time.h 421098b7FK3xgShpnH0I0Ou3O4fJ2Q xen/include/asm-ia64/tlb.h 421098b78IGdFOGUlPmpS7h_QBmoFg xen/include/asm-ia64/vcpu.h @@ -1416,6 +1415,7 @@ 40589969nPq3DMzv24RDb5LXE9brHw xen/include/xen/sched-if.h 3ddb79c0LzqqS0LhAQ50ekgj4oGl7Q xen/include/xen/sched.h 403a06a7H0hpHcKpAiDe5BPnaXWTlA xen/include/xen/serial.h +4252c315hw0xXYMKIfFzhomi1M1yNA xen/include/xen/shadow.h 3ddb79c14dXIhP7C2ahnoD08K90G_w xen/include/xen/slab.h 3ddb79c09xbS-xxfKxuV3JETIhBzmg xen/include/xen/smp.h 3ddb79c1Vi5VleJAOKHAlY0G2zAsgw xen/include/xen/softirq.h diff --git a/xen/common/dom0_ops.c b/xen/common/dom0_ops.c index 0c6bb484e0..2df3dda433 100644 --- a/xen/common/dom0_ops.c +++ b/xen/common/dom0_ops.c @@ -17,7 +17,6 @@ #include #include #include -#include #include #define TRC_DOM0OP_ENTER_BASE 0x00020000 diff --git a/xen/common/dom_mem_ops.c b/xen/common/dom_mem_ops.c index d1f4d39302..e8e3b7b256 100644 --- a/xen/common/dom_mem_ops.c +++ b/xen/common/dom_mem_ops.c @@ -13,8 +13,8 @@ #include #include #include +#include #include -#include /* * To allow safe resume of do_dom_mem_op() after preemption, we need to know @@ -112,26 +112,7 @@ free_dom_mem(struct domain *d, if ( test_and_clear_bit(_PGC_allocated, &page->count_info) ) put_page(page); - if ( unlikely(shadow_mode_enabled(d)) ) - { - // XXX This needs more thought. This isn't pretty, - // and it's not fast. But it's a place holder. - // - shadow_lock(d); - if ( page_out_of_sync(page) ) - __shadow_sync_mfn(d, mpfn + j); - shadow_remove_all_access(d, mpfn + j); - - if (page->count_info != 1) - { - printk("free_dom_mem in shadow mode didn't release page " - "mfn=%p c=%p\n", mpfn+j, page->count_info); - shadow_unlock(d); - audit_domain(d); - BUG(); - } - shadow_unlock(d); - } + shadow_sync_and_drop_references(d, page); put_page(page); } diff --git a/xen/common/domain.c b/xen/common/domain.c index dff6c033af..81a3953739 100644 --- a/xen/common/domain.c +++ b/xen/common/domain.c @@ -15,7 +15,6 @@ #include #include #include -#include #include #include #include diff --git a/xen/common/grant_table.c b/xen/common/grant_table.c index 14648c3aff..5522b44a82 100644 --- a/xen/common/grant_table.c +++ b/xen/common/grant_table.c @@ -27,8 +27,8 @@ #include #include -#include -#include +#include +#include #define PIN_FAIL(_lbl, _rc, _f, _a...) \ do { \ diff --git a/xen/common/page_alloc.c b/xen/common/page_alloc.c index ddbed43620..5df70a0ad2 100644 --- a/xen/common/page_alloc.c +++ b/xen/common/page_alloc.c @@ -30,9 +30,9 @@ #include #include #include +#include #include #include -#include /* * Comma-separated list of hexadecimal page numbers containing bad bytes. @@ -561,22 +561,7 @@ void free_domheap_pages(struct pfn_info *pg, unsigned int order) for ( i = 0; i < (1 << order); i++ ) { - if ( ((pg[i].u.inuse.type_info & PGT_count_mask) != 0) && - shadow_mode_enabled(d) ) - { - // XXX This needs more thought... - // - printk("%s: needing to call shadow_remove_all_access for mfn=%p\n", - __func__, page_to_pfn(&pg[i])); - printk("Amfn=%p c=%p t=%p\n", page_to_pfn(&pg[i]), - pg[i].count_info, pg[i].u.inuse.type_info); - shadow_lock(d); - shadow_remove_all_access(d, page_to_pfn(&pg[i])); - shadow_unlock(d); - printk("Bmfn=%p c=%p t=%p\n", page_to_pfn(&pg[i]), - pg[i].count_info, pg[i].u.inuse.type_info); - } - + shadow_drop_references(d, &pg[i]); ASSERT((pg[i].u.inuse.type_info & PGT_count_mask) == 0); pg[i].tlbflush_timestamp = tlbflush_current_time(); pg[i].u.free.cpu_mask = d->cpuset; diff --git a/xen/include/asm-ia64/shadow.h b/xen/include/asm-ia64/shadow.h deleted file mode 100644 index a9f07b19fd..0000000000 --- a/xen/include/asm-ia64/shadow.h +++ /dev/null @@ -1,3 +0,0 @@ - -#define shadow_lock_init(d) do {} while(0) -#define shadow_mode_init(d) do {} while(0) diff --git a/xen/include/asm-x86/shadow.h b/xen/include/asm-x86/shadow.h index 4aa84b1d17..4659468f39 100644 --- a/xen/include/asm-x86/shadow.h +++ b/xen/include/asm-x86/shadow.h @@ -377,6 +377,52 @@ update_hl2e(struct exec_domain *ed, unsigned long va) } } +static inline void shadow_drop_references( + struct domain *d, struct pfn_info *page) +{ + if ( likely(!shadow_mode_enabled(d)) || + ((page->u.inuse.type_info & PGT_count_mask) == 0) ) + return; + + /* XXX This needs more thought... */ + printk("%s: needing to call shadow_remove_all_access for mfn=%p\n", + __func__, page_to_pfn(page)); + printk("Before: mfn=%p c=%p t=%p\n", page_to_pfn(page), + page->count_info, page->u.inuse.type_info); + + shadow_lock(d); + shadow_remove_all_access(d, page_to_pfn(page)); + shadow_unlock(d); + + printk("After: mfn=%p c=%p t=%p\n", page_to_pfn(page), + page->count_info, page->u.inuse.type_info); +} + +static inline void shadow_sync_and_drop_references( + struct domain *d, struct pfn_info *page) +{ + if ( likely(!shadow_mode_enabled(d)) ) + return; + + /* XXX Needs more thought. Neither pretty nor fast: a place holder. */ + shadow_lock(d); + + if ( page_out_of_sync(page) ) + __shadow_sync_mfn(d, page_to_pfn(page)); + + shadow_remove_all_access(d, page_to_pfn(page)); + + if ( page->count_info != 1 ) + { + printk("free_dom_mem in shadow mode didn't release page " + "mfn=%p c=%p\n", page_to_pfn(page), page->count_info); + shadow_unlock(d); + audit_domain(d); + BUG(); + } + + shadow_unlock(d); +} /************************************************************************/ diff --git a/xen/include/xen/perfc.h b/xen/include/xen/perfc.h index 108bf5982c..6d758497b1 100644 --- a/xen/include/xen/perfc.h +++ b/xen/include/xen/perfc.h @@ -111,7 +111,9 @@ extern struct perfcounter perfcounters; #define perfc_incr(x) ((void)0) #define perfc_decr(x) ((void)0) #define perfc_incrc(x) ((void)0) +#define perfc_decrc(x) ((void)0) #define perfc_incra(x,y) ((void)0) +#define perfc_decra(x,y) ((void)0) #define perfc_add(x,y) ((void)0) #define perfc_addc(x,y) ((void)0) #define perfc_adda(x,y,z) ((void)0) diff --git a/xen/include/xen/shadow.h b/xen/include/xen/shadow.h new file mode 100644 index 0000000000..8379d4fd45 --- /dev/null +++ b/xen/include/xen/shadow.h @@ -0,0 +1,18 @@ + +#ifndef __XEN_SHADOW_H__ +#define __XEN_SHADOW_H__ + +#include + +#ifdef CONFIG_X86 + +#include + +#else + +#define shadow_drop_references(_d, _p) ((void)0) +#define shadow_sync_and_drop_references(_d, _p) ((void)0) + +#endif + +#endif /* __XEN_SHADOW_H__ */ -- 2.30.2